<?php get_header(); ?>
<!--<a href="<?php //echo xemphim($idphim); ?>">xem phim</a>-->

<?php $options = get_option('nominal'); ?>

<?php 
    $idphim = get_the_ID();
    $idtap = get_query_var('ep');
?>

<div class="wrapper-container">
    
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
        <div class="container content">
            <?php if ($options['mts_breadcrumb'] == '1') { ?>
    			<div class="breadcrumb"><?php the_breadcrumb(); ?></div>
    		<?php } ?>
            <div><h2><?php the_title(); ?></h2></div>
            <?php if($idtap != ''): ?>
                <?php echo getlinkphim($idphim,$idtap); ?>
                <?php echo episode_show($idphim);?>
                <h3 class="title_h1_st1"><a>Download: </a></h3>
                <!--<div class="wrapper-download"><h3>Download: </h3></div>-->
                <div class="tab1"><a onclick="switchMenu1();" id="title1" href="#1">480</a></div>
                <div class="tab2"><a onclick="switchMenu2();" id="title2" href="#2">720</a></div>

                <div id="div1" class="mb20 screen">
                    
                </div>
                <div id="div2" class="mb20 screen" style="display:none">
                	<iframe width="100%" height="520" src="http://www.youtube.com/embed/sYpMUDg78RE" frameborder="0" allowfullscreen></iframe>
                </div>
            <?php else :?>
                <?php if ( has_post_thumbnail() ) { ?>
                    <div id="wrapper-cover-play">
                        <div class="filmLeft"><?php the_post_thumbnail(array(204, 204));  ?></div>
                        <div id="action">
                            <!--<a href="#" class="btn btn-hot text-uppercase btn-lg">Download</a>-->
                            <a href="<?php echo xemphim($idphim); ?>" class="btn btn-sky text-uppercase btn-lg">Xem phim <img src="" /></a>
                        </div>        
                    </div>
                <?php }else{ ?>
                    <div class="filmLeft">
                        <img src="http://fsharefilm.com/wp-content/uploads/2014/08/default_cover.jpg" />
                        <div id="action">
                            <!--<a href="#" class="btn btn-hot text-uppercase btn-lg">Download</a>-->
                            <a href="<?php echo xemphim($idphim); ?>" class="btn btn-sky text-uppercase btn-lg">Xem phim <img src="" /></a>
                        </div>
                    </div>
                <?php } ?>
            	
                <div class="filmRight">
                	<p>Năm phát hành: 2014</p>
                    <p>Thời lượng: 141 phút</p>
                    <p>IMDB: 7.6</p>
                    <p>Đánh giá phim: 9.37 (855 lượt)</p>
                    <p>Đạo diễn: Marc Webb</p>
                    <p>Diễn viên: Andrew Garfield, Jamie Foxx, Emma Stone, Sally Field, Dane DeHaan, Colm Feore, Paul Giamatti</p>
                    <p>Quốc gia: Âu-Mỹ</p>
                    <p>Thể loại: Hành động, Phiêu lưu</p>
                    <p>Tag: Người Nhện, Marvel Comics, Superheroes, Phim 2014, Phim Chiếu Rạp</p>
                </div>
                
                
                <h3 class="title_h1_st1"><a href="#">Download: </a></h3>
                
                <div class="tab1"><a onclick="switchMenu1();" id="title1" href="#1">mHD</a></div>
                <div class="tab2"><a onclick="switchMenu2();" id="title2" href="#2">720</a></div>
                
                <?php if(get_field( "mhd" ) != ''): ?>
                    <div id="div1" class="mb20 screen">
                        <?php the_field('mhd'); ?>
                    </div>
                <?php endif; ?>
                <div id="div2" class="mb20 screen" style="display:none">
                	<iframe width="100%" height="520" src="http://www.youtube.com/embed/sYpMUDg78RE" frameborder="0" allowfullscreen></iframe>
                </div>
                
                <h3 class="title_h1_st1"><a href="#">Giới thiệu phim: </a></h3>
                <div class="filmDes">
                    Trong phần này, phim hé lộ mối quan hệ giữa Richard Parker - bố của Peter và tập đoàn Oscorp cùng nghiên cứu bí mật mà bố cậu từng thực hiện cho Oscorp khiến gia đình cậu bị truy đuổi. Harry Osborn - người bạn lâu năm của Peter quyết định theo đuổi tham vọng thay đổi thế giới, trở thành kẻ thù hùng mạnh nhất mà Người Nhện phải đương đầu…
                </div>
            <?php endif; ?>
            
        </div>
        <?php if($options['mts_social_buttons'] == '1') { ?>
    		<div class="shareit">
    			<?php if($options['mts_twitter'] == '1') { ?>
    				<!-- Twitter -->
    				<span class="share-item twitterbtn">
    				<a href="https://twitter.com/share" class="twitter-share-button" data-via="<?php echo $options['mts_twitter_username']; ?>">Tweet</a>
    				</span>
    			<?php } ?>
    			<?php if($options['mts_gplus'] == '1') { ?>
    				<!-- GPlus -->
    				<span class="share-item gplusbtn">
    				<g:plusone size="medium"></g:plusone>
    				</span>
    			<?php } ?>
    			<?php if($options['mts_facebook'] == '1') { ?>
    				<!-- Facebook -->
    				<span class="share-item facebookbtn">
    				<div id="fb-root"></div>
    				<div class="fb-like" data-send="false" data-layout="button_count" data-width="150" data-show-faces="false"></div>
    				</span>
    			<?php } ?>
    			<?php if($options['mts_linkedin'] == '1') { ?>
    				<!--Linkedin -->
    				<span class="share-item linkedinbtn">
    				<script type="text/javascript" src="http://platform.linkedin.com/in.js"></script><script type="in/share" data-url="<?php the_permalink(); ?>" data-counter="right"></script>
    				</span>
    			<?php } ?>
    			<?php if($options['mts_stumble'] == '1') { ?>
    				<!-- Stumble -->
    				<span class="share-item stumblebtn">
        				<su:badge layout="1"></su:badge>
        				<script type="text/javascript"> 
            				(function() { 
                				var li = document.createElement('script'); li.type = 'text/javascript'; li.async = true; 
                				li.src = window.location.protocol + '//platform.stumbleupon.com/1/widgets.js'; 
                				var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(li, s); 
            				})(); 
    				    </script>
    				</span>
    			<?php } ?>
    			<?php if($options['mts_pinterest'] == '1') { ?>
    				<!-- Pinterest -->
    				<span class="share-item pinbtn">
    				<a href="http://pinterest.com/pin/create/button/?url=<?php the_permalink(); ?>&media=<?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large' ); echo $thumb['0']; ?>&description=<?php the_title(); ?>" class="pin-it-button" count-layout="horizontal">Pin It</a>
    				<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
    				</span>
    			<?php } ?>
    		</div>
    	<?php } ?><!--Shareit-->
    <?php endwhile; ?>
    <div id="sidebar">
        <?php get_sidebar(); ?>
    </div>
</div>


<?php /*
<div id="page" class="single">
	<div class="content">
		<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
			<article class="article">
                <?php 
                    $idphim = get_the_ID(); 
                    //echo xemphim($idphim);
                    $idtap = get_query_var('ep');
                    echo $idtap ;
                    echo getlinkphim($idphim,$idtap);
                ?>
				<div id="content_box">
					<div class="single_post">
						<div id="content_bg" class="singleCon">
							<?php if ($options['mts_breadcrumb'] == '1') { ?>
								<div class="breadcrumb"><?php the_breadcrumb(); ?></div>
							<?php } ?>
							<header>
								<h1 class="title single-title"><?php the_title(); ?></h1>
								<?php if($options['mts_headline_meta'] == '1') { ?>
									<div class="tablePost"><?php _e('Author: ','mythemeshop'); the_author_posts_link(); ?> | <span class="metadate"><?php echo '<div class="post_date"><div class="month">'.get_the_time('M').'</div><div class="day">'.get_the_time('d').'</div><div class="year">'.get_the_time('Y').'</div></div>'; ?></span> <span class="thecategories"><?php _e('Posted in ', 'mythemeshop'); the_category(', ') ?></span> <span class="thecomment"><a href="<?php comments_link(); ?>"><?php comments_number(' No comments',' 1 Comment',' % Comments'); ?></a></span></div>
								<?php } ?>
							</header><!--.headline_area-->
							<div id="post-<?php the_ID(); ?>" <?php post_class('g post'); ?>>
								<div class="post-single-content box mark-links">
									<?php if ($options['mts_posttop_adcode'] != '') { ?>
										<?php $toptime = $options['mts_posttop_adcode_time']; if (strcmp( date("Y-m-d", strtotime( "-$toptime day")), get_the_time("Y-m-d") ) >= 0) { ?>
											<div class="topad">
												<?php echo $options['mts_posttop_adcode']; ?>
											</div>
										<?php } ?>
									<?php } ?>						
									<?php the_content(); ?>
									<?php wp_link_pages('before=<div class="pagination2">&after=</div>'); ?>
									<?php if ($options['mts_postend_adcode'] != '') { ?>
										<?php $endtime = $options['mts_postend_adcode_time']; if (strcmp( date("Y-m-d", strtotime( "-$endtime day")), get_the_time("Y-m-d") ) >= 0) { ?>
											<div class="bottomad">
												<?php echo $options['mts_postend_adcode'];?>
											</div>
										<?php } ?>
									<?php } ?> 
									<?php if($options['mts_tags'] == '1') { ?>
										<div class="tags"><?php the_tags('<span class="tagtext">Tags:</span>',', ') ?></div>
									<?php } ?>
									<?php if($options['mts_social_buttons'] == '1') { ?>
										<div class="shareit">
											<?php if($options['mts_twitter'] == '1') { ?>
												<!-- Twitter -->
												<span class="share-item twitterbtn">
												<a href="https://twitter.com/share" class="twitter-share-button" data-via="<?php echo $options['mts_twitter_username']; ?>">Tweet</a>
												</span>
											<?php } ?>
											<?php if($options['mts_gplus'] == '1') { ?>
												<!-- GPlus -->
												<span class="share-item gplusbtn">
												<g:plusone size="medium"></g:plusone>
												</span>
											<?php } ?>
											<?php if($options['mts_facebook'] == '1') { ?>
												<!-- Facebook -->
												<span class="share-item facebookbtn">
												<div id="fb-root"></div>
												<div class="fb-like" data-send="false" data-layout="button_count" data-width="150" data-show-faces="false"></div>
												</span>
											<?php } ?>
											<?php if($options['mts_linkedin'] == '1') { ?>
												<!--Linkedin -->
												<span class="share-item linkedinbtn">
												<script type="text/javascript" src="http://platform.linkedin.com/in.js"></script><script type="in/share" data-url="<?php the_permalink(); ?>" data-counter="right"></script>
												</span>
											<?php } ?>
											<?php if($options['mts_stumble'] == '1') { ?>
												<!-- Stumble -->
												<span class="share-item stumblebtn">
												<su:badge layout="1"></su:badge>
												<script type="text/javascript"> 
												(function() { 
												var li = document.createElement('script'); li.type = 'text/javascript'; li.async = true; 
												li.src = window.location.protocol + '//platform.stumbleupon.com/1/widgets.js'; 
												var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(li, s); 
												})(); 
												</script>
												</span>
											<?php } ?>
											<?php if($options['mts_pinterest'] == '1') { ?>
												<!-- Pinterest -->
												<span class="share-item pinbtn">
												<a href="http://pinterest.com/pin/create/button/?url=<?php the_permalink(); ?>&media=<?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large' ); echo $thumb['0']; ?>&description=<?php the_title(); ?>" class="pin-it-button" count-layout="horizontal">Pin It</a>
												<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
												</span>
											<?php } ?>
										</div>
									<?php } ?><!--Shareit-->
								</div>
							</div>
						</div><!--.post-content box mark-links-->
						<?php if($options['mts_related_posts'] == '1') { ?>	
						<?php $categories = get_the_category($post->ID); if ($categories) { $category_ids = array(); foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id; $args=array( 'category__in' => $category_ids, 'post__not_in' => array($post->ID), 'showposts'=>4, 'orderby'=> rand, 'caller_get_posts'=>1 );
							$my_query = new wp_query( $args );
							if( $my_query->have_posts() ) {
							echo '<div id="content_bg" class="singleCon" style="border-top:none;"><div class="related-posts"><h4>';
							echo _e('Related Posts', 'mythemeshop').'</h4><ul>';
							while( $my_query->have_posts() ) { ++$counter; if($counter == 4) { $postclass = 'last'; $counter = 0; } else { $postclass = '';} $my_query->the_post(); ?>
							<li class="<?php echo $postclass; ?>">
								<a rel="nofollow" class="relatedthumb" href="<?php the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>">
									<span class="rthumb">
										<div class="clear"></div>	
										<?php if(has_post_thumbnail()): ?>
											<?php the_post_thumbnail('related', 'title='); ?>		
										<?php else: ?>
											<img src="<?php echo get_template_directory_uri(); ?>/images/relthumb.jpg" alt="<?php the_title(); ?>"  width='140' height='140' class="wp-post-image" />											
										<?php endif; ?>
									</span>
								</a>
								<a class="relatedthumb" href="<?php the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php  echo the_title(); ?></a>
							</li>
							<?php } echo '</ul></div></div>';}}	wp_reset_query(); ?>
							<!-- .related-posts -->	
						<?php } ?>
						<?php if($options['mts_author_box'] == '1') { ?>
							<div class="postauthor">
								<h4><?php _e('About Author', 'mythemeshop'); ?></h4>
								<?php if(function_exists('get_avatar')) { echo get_avatar( get_the_author_meta('email'), '75' );  } ?><b><?php if(the_author_link() != ''): ?><a href="<?php get_the_author_link(); ?>" target="_blank"><?php the_author_meta( first_name, $userID ); ?></a><?php endif; ?></b>
								<p><?php the_author_meta('description') ?></p>
							</div>
						<?php }?>  
					</div><!--.g post-->
					<?php //comments_template( '', true ); ?>
				</div>
			</article>
		<?php endwhile; /* end loop */ ?>
        
		<?php get_sidebar(); ?>
        
        <script type="text/javascript">function setActive(){aObj=document.getElementById("servers").getElementsByTagName("a");for(i=0;i<aObj.length;i++)0<=document.location.href.indexOf(aObj[i].href)&&(aObj[i].className="active")}window.onload=setActive;</script>	
        <script type="text/javascript">Phim3s.Watch.init('<?php echo $post->ID;?>');</script>
        
<?php get_footer(); ?>